<?php

namespace JsonLowCode\Form\Fields;

use JsonLowCode\UI\Rate;
use JsonLowCode\Form\Abstract\FieldAbstract;
use JsonLowCode\Form\Traits\HasClearable;
use JsonLowCode\Form\Traits\HasDisabled;
use JsonLowCode\Form\Traits\HasReadonly;
use JsonLowCode\Form\Traits\HasSize;

/**
 * @property Rate $element
 */
class RateField extends FieldAbstract
{

    use HasSize, HasClearable, HasReadonly;

    protected function booting(): void
    {
        $this->element = new Rate();
    }

    /**
     * 禁用
     * @param bool|string $bool
     * @param bool $isJSExpression
     * @return $this
     */
    public function disabled(bool|string $bool = true,  bool $isJSExpression = false): static
    {
        $this->readonly($bool, $isJSExpression);
        return $this;
    }
}
